﻿using System;
using System.Collections.Generic;
using DTO;
using DAO;

namespace BUS
{
    public class NhanVienBUS
    {
        private NhanVienDAO m_NhanVienDAO = new NhanVienDAO();

        public List<NhanVienDTO> GetListNV()
        {
            try
            {
                return m_NhanVienDAO.GetListNV();
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public bool InsertNV(NhanVienDTO nv)
        {
            try
            {
                if (nv.STenNV.Length < 3)
                    throw new Exception("Tên không được ít hơn 3 kí tự");
                return m_NhanVienDAO.InsertNV(nv);
            }
            catch (Exception ex)
            {
                throw;
            }
        }

        public bool DeleteNV(int manv)
        {
            try
            {
                return m_NhanVienDAO.DeleteNV(manv);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }
}
